<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width" />
		<title>HELLO, AMAP!</title>
		<style>
			html,
			body,
			#container {
				width: 100%;
				height: 100%;
			}
		</style>


	</head>

	<body>
		<div id="container"></div>

		<script type="text/javascript">
			window._AMapSecurityConfig = {
				securityJsCode: "a87006994c7de96ee7a4564fd85da550",
			};
		</script>
		<script src="https://webapi.amap.com/maps?v=1.4.15&key=a9869ed4cec0ed367bf9c7de2b4ea895"></script>
		<script>
			var map = new AMap.Map("container", {
				zoom: 15, //级别
				center: [116.397428, 39.90923], //中心点坐标
			})

			function beginDriving(start, end) {
				AMap.plugin("AMap.Driving", function() {
					var driving = new AMap.Driving({
						// 驾车路线规划策略，AMap.DrivingPolicy.LEAST_TIME是最快捷模式
						policy: AMap.DrivingPolicy.LEAST_TIME,
						map,
					})
					var points = [{
						keyword: start
					}, {
						keyword: end
					}]
					driving.search(points, function(status, result) {
						// 未出错时，result即是对应的路线规划方案
					})
				})
			}

		</script>

	</body>
</html>
